<template>
  <el-dialog
      :visible.sync="visible"
      width="650px"
      :before-close="onClose">
      <div slot="title" style="font-size: 14px;font-weight: 500;">
        新托管企微号设置
      </div>
      <div class="deposit-dialog-main">
        <el-form :model="form" status-icon ref="form" label-width="90px" label-position="left" class="demo-ruleForm">
          <el-form-item label="企微号：" prop="pass">
            <span>所有新托管的企微号</span>
          </el-form-item>
          <el-form-item label="是否分配：" prop="type">
            <el-radio-group v-model="form.type">
              <el-radio :label="1">不分配</el-radio>
              <el-radio :label="0">分配</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="分配规则：" prop="rule">
            <el-radio-group v-model="form.rule">
              <el-radio :label="0">随机分配</el-radio>
              <el-radio :label="1">优先分配</el-radio>
              <el-radio :label="2">固定分配</el-radio>
            </el-radio-group>
            <div v-if="form.rule==0" class="c_999">将对话随机分配给所有上班的客服</div>
            <div v-if="form.rule==1" class="c_999">将对话优先分配给某个分组上班的客服，该分组客服均达承接上限后会分配其他客服</div>
            <div v-if="form.rule==2" class="c_999">将对话固定分配给某个分组上班的客服，该分组客服均达承接上限后对话进入排队</div>
          </el-form-item>
          <el-form-item v-if="form.rule!==0" label="对应分组：" prop="pass">
            <TreeSelect
              v-model="form.group"
              placeholder="请选择"
              :props="{
                value:'id',
                label: 'label',
                children: 'children',
              }"
              :options="treeList"
              width="100%"
            ></TreeSelect>
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="onClose">取消</el-button>
        <el-button type="primary" @click="onClose">确定</el-button>
      </span>
    </el-dialog>
</template>
<script>
import TreeSelect from "@/components/TreeSelect";
export default {
  data() {
    return {
      form: {
        type: '1',
        isDistribute: 0
      },
      typeIndex: 1,
      types: [
        { id: 1, title: '私聊+群聊'},
        { id: 2, title: '私聊'},
        { id: 3, title: '群聊'},
      ],
      treeList: [
        {
          id: 1,
          label: "一级 1",
          children: [
            {
              id: 2,
              label: "二级 1-1",
            },
          ],
        },
        {
          id: 3,
          label: "一级 2",
        },
      ],
    }
  },
  props: ['visible'],
  components:{
    TreeSelect
  },
  methods: {
    onClose() {
      this.$emit('handCloseDialog');
    }
  },
}
</script>
<style lang="scss" scoped>
.import-batc-main {
  font-size: 14px;
  line-height: 22px;
  word-wrap: break-word;
  .batc-item:first-child {
    margin-bottom: 10px;
  }
}
</style>